/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package model.DAO;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import model.entities.BillItemType;
import model.entities.RoomType;

/**
 *
 * @author Hieu.Nguyen
 */
public class BillItemTypeDAO {
    private static BillItemTypeDAO billItemTypeDAO;

    public static BillItemTypeDAO getInstance() {
        if (billItemTypeDAO == null) {
            billItemTypeDAO = new BillItemTypeDAO();
        }
        return billItemTypeDAO;
    }
    
     public List<BillItemType> getBillItemType(boolean isActived) {
        List<BillItemType> listBillItemType = new ArrayList<BillItemType>();
        try {
            Connection conn = ConnectionFactory.getConnection();
            String sql = "select * from tblBillItemType";
            PreparedStatement pstmt = conn.prepareStatement(sql);
            
            ResultSet rs = pstmt.executeQuery();
            while (rs.next()) {
                BillItemType r = new BillItemType();
                r.setBillItemTypeID(rs.getInt("BillItemTypeID"));
                r.setBillItemType(rs.getString("BillItemType"));
                r.setDescription(rs.getString("Description"));
                listBillItemType.add(r);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return listBillItemType;
    }
    
}
